//
//  AppendLogsModel.m
//  YuTang
//
//  Created by 葛悦彣 on 2024/9/9.
//

#import "AppendLogsModel.h"

@implementation AppendLogsModel

+ (NSDictionary *)modelCustomPropertyMapper {
    return @{@"ID":@[@"id"],
             @"taskDetailModelList":@[@"pondModelList",@"taskDetailModelList"]
    };
}

+ (NSDictionary *)modelContainerPropertyGenericClass {
    return @{
//        @"pondModelList":[pondModelListModel class],
        @"taskDetailModelList":[taskDetailModelListModel class],

        @"pondTissues":[CombinedPunchTissueListModel class],
    };
}

- (NSString *)tissueListStr{
    if(!_tissueListStr){
        NSMutableArray <NSString *>* strArray = [NSMutableArray array];
        for (CombinedPunchTissueListModel * model in self.pondTissues) {
            NSString * str = [NSString stringWithFormat:@"%@ %@",model.pondTissue,model.pondName];
            [strArray addObject:str];
        }
        _tissueListStr = [strArray componentsJoinedByString:@"\n"];
    }
    return _tissueListStr;
}

- (CGFloat)tissueListStrH{
    CGFloat textH = [DTKTool textWithtitle:self.tissueListStr andSize:CGSizeMake(kwt(265), 10000) andFout:kCFont(16)].height;
    if(textH < kwt(15)){
        return kwt(15);
    }
    return textH;
}

- (CGFloat)CellH{
    _CellH = kwt(60 + 10 + 5)+ self.tissueListStrH + self.executorStrH;
    if(self.taskDetailModelList.count > 1){
        
        ///加1个标题
        for (taskDetailModelListModel * model in self.taskDetailModelList) {
            if(model.isSQ){
                _CellH += kwt(48);
            } else {
                _CellH += model.RZstrH + kwt(8 + 20 + 40);
            }
        }
    } else  if(self.taskDetailModelList.count == 1){
        _CellH += self.taskDetailModelList.firstObject.RZstrH + kwt(8 + 20);
    }
    
    if(self.cardImgArray.count > 0){
        _CellH += kwt(80);
        if(self.cardImgArray.count > 5){
            _CellH += kwt(60);
        }
    }
    if(self.voiceUrl.length > 0){
        _CellH += kwt(50);
    }
    
    
    return _CellH;
    
}
@end
